
CFLAGS=-fPIC -g
EXCFLAGS:=
EXTERLIBS:=

#CROSS_COMPILE = 
#CROSS_COMPILE = armv5-linux-
#CROSS_COMPILE = cortex_a8-linux-
CROSS_COMPILE = armv7-linux-
#CROSS_COMPILE = powerpc-mpc83xx-linux-
#CROSS_COMPILE = mipsel-openwrt-linux-

	# 指定编译器设置
CC=$(CROSS_COMPILE)gcc
STRIP=$(CROSS_COMPILE)strip
AR=$(CROSS_COMPILE)ar


CFLAGS += $(EXCFLAGS) 
#LDFLAGS += $(EXLDFLAGS)  -lrt -lpthread
LDFLAGS :=  -lpthread

LIBS = $(EXTERLIBS) 

target:= poll 
server:= ser
client:= cli
bulide:= main.o link.o  gateway.o  thread_pool.o

all: $(target) $(server) $(client)


$(target):$(bulide)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ 
	$(STRIP) $@
	rm *.o
	
$(server):server.c  gateway.c
	gcc  -o $@ $^

$(client):cli.c gateway.c
	gcc  -o $@ $^ -lpthread
	
%.o: %.c
	$(CC) $(CFLAGS) -c $<
	
clean:
	rm   $(target)  
	